package itsm.isperp.module.repository.db;

import itsm.isperp.framework.data.mybatis.dao.CUDMapper;
import itsm.isperp.module.entity.db.DbEntityField;
import itsm.isperp.module.entity.db.DbEntityFieldControl;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 实体字段映射器
 * 
 * @author lizx
 * @date 2013-5-4
 */
@Repository
public interface DbEntityFieldMapper extends CUDMapper<DbEntityField> {

	/**
	 * 根据实体名称获取其字段定义
	 * 
	 * @param entityName
	 *            实体名称
	 * @return List
	 */
	public List<DbEntityField> findAllByEntityName(String entityName);

	/**
	 * 
	 * @param tableName
	 * @return
	 */
	public List<DbEntityField> findAllByTableName(String tableName);

	/**
	 * 
	 * @param tableName
	 * @param columnName
	 * @return
	 */
	public DbEntityField findOneByTableNameAndColumn(
			@Param("tableName") String tableName,
			@Param("columnName") String columnName);

	/**
	 * 获取实体字段的控件定义
	 * 
	 * @param id
	 * @return DbEntityFieldControl
	 */
	public DbEntityFieldControl findFieldControl(String id);

	/**
	 * 根据实体id删除
	 * 
	 * @param id实体id
	 */
	public void deleteByEntityId(@Param("entityId") String entityId);

}
